/*
 * Constraints.java
 * Created on March 14, 2008, 2:05 PM
 */

package view;

import java.util.Vector;

/**
 *
 * @author Erol Hira
 */
public class Constraints {
      
    
    private Vector constraintKeys;
    private Vector constraintValues;
    
    
    public Constraints() {
        constraintKeys = new Vector(4);
        constraintValues = new Vector(4);
    }
    
    public void put(byte key, byte value){
        constraintKeys.addElement(new Byte(key));
        constraintValues.addElement(new Byte(value));
    }
    
    public byte get(byte key){
        
        for(int i = 0; i < constraintKeys.size(); i++){            
            if(((Byte)constraintKeys.elementAt(i)).byteValue() == key){
                return ((Byte)constraintValues.elementAt(i)).byteValue();
            }
        }
        
        return -1;
    }
    
    public byte getKey(int index){
        return ((Byte)constraintKeys.elementAt(index)).byteValue();
    }
    
    public byte getValue(int index){
        return ((Byte)constraintValues.elementAt(index)).byteValue();
    }
}
